#!/bin/bash

# Function to get current Wi-Fi network name
get_current_wifi() {
    /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk -F': ' '/ SSID/{print $2}'
}

# Main execution starts here
current_wifi=$(get_current_wifi)

if [ -n "$current_wifi" ]; then
    echo "当前连接的 Wi-Fi 网络: $current_wifi"
else
    echo "当前没有连接 Wi-Fi"
fi
